<template>
	<view>
		<z-paging ref="paging" :refresher-enabled="false">
			<v-headerview actionBarColor="#000000" :showBackIcon="true" titleColor="#000" pageTitle="兑换">
				<view class="swiper_box">
					<tn-swiper @change="swsiperChange" :list="swiperList" :autoplay="true" :current="swipercurrent"
						effect3dPreviousSpacing="230" height="472" radius="0"></tn-swiper>
					<view class="dibubaise_box">
						<view class="dangqianjf_box">{{ userInfo.integral * 1 }}</view>
						<view class="mx_box">
							<view class="l_box">当前积分</view>
							<view class="r_box">
								<view class="gengduo_box" @click="$router('/redemption/dhReward')">兑换记录</view>
								<view class="icon_you_box"></view>
							</view>
						</view>
					</view>
				</view>
				<view class="jifensp_bopx">
					<view class="bbt_box">
						积分兑换菜品
					</view>
					<scroll-view class="caipin_box" scroll-y>
						<view class="nr_box">
							<view class="dange_sp_box" v-for="(item, index) in spLIst" :key="index">
								<view class="top_img">
									<image class="" :src="item.image" />
								</view>
								<view class="name_box slh">{{ item.title }}</view>
								<view class="price_box">
									<text style="margin-right: 30rpx;">{{ item.integral * 1 }}积分</text>
									<text style="text-decoration:line-through; opacity: .7;">￥{{ item.price*1 }}</text>
								</view>
								<view class="ys_box">已售{{ item.sales }}份</view>
								<view class="dh_box" @click="$router('/redemption/dh?id=' + item.id)">兑换</view>
							</view>
							<view class="zw" style="width: 260rpx;"></view>
						</view>
					</scroll-view>
				</view>
			</v-headerview>
		</z-paging>
	</view>

</template>

<script>
	export default {
		components: {},
		data() {
			return {
				swiperList: ['https://image.dingxians.cn/image/2025-09-15/160741016.jpg'], //轮播
				spLIst: [],

				userInfo: {},
			};
		},
		onLoad(e) {

		},
		onShow() {
			this.getList()
			this.getBanner()
			this.getInfo()
		},
		methods: {
			getInfo() {
				this.$Request.get(this.$api.user.users).then(res => {
					this.userInfo = res.data
				})
			},
			getList() {
				this.$Request.get(this.$api.index.goods).then(res => {
					this.spLIst = res.data.data
				})
			},
			getBanner() {
				this.$Request.get(this.$api.index.banners).then(res => {
					this.swiperList = res.data
				})
			}
		}
	};
</script>

<style lang="scss" scoped>
	/deep/.zp-scroll-view-absolute {
		background-image: none !important;
		background-color: #fff !important;
		position: relative !important;
	}

	/deep/.tn-row-notice-class {
		padding: 0 !important;
		height: 60rpx !important;
		line-height: 60rpx !important;
	}

	.swiper_box {
		width: 750rpx;
		height: 472rpx;
		position: relative;

		.gg_box {
			width: 750rpx;
			height: 60rpx;
			background-color: #fff;
			border-radius: 30rpx 30rpx 0 0;
			position: absolute;
			bottom: 0;
			left: 0;
			right: 0;
			margin: auto;
		}

		.dibubaise_box {
			width: 100%;
			height: 100rpx;
			position: absolute;
			bottom: -50rpx;
			background-color: #fff;
			border-radius: 30rpx 30rpx 0 0;
			box-sizing: border-box;
			padding: 0 30rpx;

			.dangqianjf_box {
				width: auto;
				height: 50rpx;
				line-height: 60rpx;
				font-size: 38rpx;
				color: #333;
				font-family: 900;

			}

			.mx_box {
				width: 100%;
				height: 50rpx;
				line-height: 50rpx;
				font-size: 22rpx;
				display: flex;
				justify-content: space-between;

				.l_box {
					width: auto;
					height: 50rpx;
					color: #c9c9c9;

				}

				.r_box {
					width: auto;
					display: flex;
					justify-content: flex-end;
					align-items: center;

					.gengduo_box {
						color: #000;
						font-size: 24rpx;

					}

					.icon_you_box {
						width: 24rpx;
						height: 24rpx;
						background-image: url('https://image.dingxians.cn/image/2025-09-15/165398803.png');
						background-size: 100% 100%;
					}
				}


			}
		}
	}

	.jifensp_bopx {
		width: 100%;
		height: auto;
		box-sizing: border-box;
		padding: 20rpx;
		margin-top: 50rpx;

		.bbt_box {
			font-size: 24rpx;
			width: 100%;
			height: 30rpx;
			line-height: 30rpx;
			color: #000;
			font-weight: 700;
			margin-bottom: 30rpx;
		}

		.caipin_box {
			width: 100%;
			height: 1000rpx;

			.nr_box {
				width: 100%;
				height: 1000rpx;
				display: flex;
				justify-content: space-around;
				flex-wrap: wrap;

				.dange_sp_box {
					flex-shrink: 0;
					position: relative;
					width: 260rpx;
					height: 400rpx;
					background-color: #f0f0f0;
					border-radius: 30rpx;
					margin-bottom: 20rpx;
					// margin: 0 50rpx;

					.top_img {
						width: 100%;
						height: 260rpx;
						border-radius: 30rpx 30rpx 0 0;

						image {
							width: 100%;
							height: 260rpx;
							border-radius: 30rpx 30rpx 0 0;
						}
					}
				}

				.name_box {
					width: 80%;
					height: 40rpx;
					line-height: 40rpx;
					font-size: 24rpx;
					color: #000;
					margin: auto;
					font-weight: 600;
					margin-bottom: 10rpx;
				}

				.price_box {
					width: 80%;
					height: 40rpx;
					line-height: 40rpx;
					font-size: 24rpx;
					color: red;
					margin: auto;
					font-weight: 600;
					margin-bottom: 24rpx;
				}

				.ys_box {
					width: 80%;
					height: 20rpx;
					font-size: 20rpx;
					line-height: 20rpx;
					color: #bbb;
					margin: auto;
				}

				.dh_box {
					width: 80rpx;
					height: 40rpx;
					line-height: 40rpx;
					background-color: #f64b43;
					color: #fff;
					text-align: center;
					position: absolute;
					bottom: 20rpx;
					right: 10rpx;
					border-radius: 10rpx;
				}
			}

		}
	}
</style>